#include <QCoreApplication>
#include <iostream>

using namespace std;

int main ()
{

    int D;
    cout << "vvedite den: "; cin >> D;
    int M;
    cout << "Vvedite mesyac: "; cin >> M;
    switch (D)
    {
        case 28:
            if (M==2) cout << "D=1; M=3; \n";
            else
                cout << "D=" << D+1 << "; M=" << M << ";\n";
            break;
        case 30:
            if ( (M==4) || (M==6) || (M==9) || (M==11) )
                    cout << "D=1; M=" << M+1 << ";\n";
            else
                cout << "D=" << D+1 << "; M=" << M << ";\n";
            break;
        case 31:
            if (M!=12) cout << "D=1; M=" << M+1 << ";\n";
                    else  cout << "D=1; M=1; \n";
            break;
                cout << "D=" << D+1 << "; M=" << M << ";\n";
        break;
    }
}
